<!DOCTYPE html>
<html>
<head>
<title>教练管理</title>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<link rel="stylesheet" href="../../css/bootstrap.min.css">
<link rel="stylesheet" href="../../css/font-awesome.min.css">
<link rel="stylesheet" href="../../css/AdminLTE.min.css">
<link rel="stylesheet" href="../../css/all-skins.min.css">
<link rel="stylesheet" href="../../plugins/jqgrid/ui.jqgrid-bootstrap.css">
<link rel="stylesheet" href="../../plugins/ztree/css/metroStyle/metroStyle.css">
<link rel="stylesheet" href="../../css/main.css">
<link rel="stylesheet" href="../../plugins/datepicker/bootstrap-datetimepicker.min.css">
<link href="vue2-timepicker.min.css" rel="stylesheet"></link>
<script src="../../libs/jquery.min.js"></script>
<script src="../../plugins/layer/layer.js"></script>
<script src="../../libs/bootstrap.min.js"></script>
<script src="../../libs/vue.min.js"></script>
<script src="../../plugins/jqgrid/grid.locale-cn.js"></script>
<script src="../../plugins/jqgrid/jquery.jqGrid.min.js"></script>
<script src="../../plugins/ztree/jquery.ztree.all.min.js"></script>
<script src="../../plugins/layer/layer.js"></script>
<script src="../../plugins/datepicker/bootstrap-datetimepicker.min.js"></script>
<script src="../../plugins/datepicker/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script>
<script src="../../js/common.js"></script>
<script src="../../libs/ajaxupload.js"></script>

	<style type="text/css">
		.itemDisabled{
			background: grey;
		}
	</style>
</head>
<body>
<div id="rrapp" v-cloak>
	<div v-show="showList">
		<div class="grid-btn ">
			<div class="form-group col-sm-2">
				<input type="text" class="form-control" v-model="q.coachName" @keyup.enter="query" placeholder="姓名">
			</div>
			<div class="form-group col-sm-2">
				<input type="text" class="form-control" v-model="q.coachIntro" @keyup.enter="query" placeholder="简介">
			</div>
			<div class="form-group col-sm-2">
				<input type="text" class="form-control" v-model="q.coachTags" @keyup.enter="query" placeholder="特长">
			</div>
			<a class="btn btn-default" @click="query">查询</a>
			<a  class="btn btn-primary" @click="add"><i class="fa fa-plus"></i>&nbsp;新增</a>
		</div>
	    <table id="jqGrid"></table>
	    <div id="jqGridPager"></div>
    </div>
    
    <div v-show="!showList" class="panel panel-default">
		<div class="panel-heading">{{title}}</div>
		<form class="form-horizontal">
			<div class="form-group">
			   	<div class="col-sm-2 control-label">姓名</div>
			   	<div class="col-sm-10">
			      <input type="text" class="form-control" v-model="coach.coachName" placeholder="姓名"/>
			    </div>
			</div>

			<div class="form-group">
			   	<div class="col-sm-2 control-label">简介</div>
			   	<div class="col-sm-10">
			      <input type="text" class="form-control" v-model="coach.coachIntro" placeholder="简介"/>
			    </div>
			</div>
			<div class="form-group">
			   	<div class="col-sm-2 control-label">特长</div>
			   	<div class="col-sm-10">
			      <input type="text" class="form-control" v-model="coach.coachTags" placeholder="特长"/>
			    </div>
			</div>
			<div class="form-group">
				<div class="col-sm-2 control-label">类别</div>
				<label class="radio-inline">
				  <input type="radio" name="status" value="1" v-model="coach.coachType"/> 健身教练
				</label>
				<label class="radio-inline">
				  <input type="radio" name="status" value="2" v-model="coach.coachType"/> 营养师
				</label>
			</div>
			<div class="form-group">
				<div class="col-sm-2 control-label">头像</div>
				<div class="col-sm-2 control-label">
					<input  id="file_upload" type="file" v-on:change="fileUpload()"></input>
				</div>
			</div>
			<div v-if="coach.coachAvatar" class="form-group">
				<div class="col-sm-2 control-label">预览</div>
				<div class="col-sm-2 control-label">
					<img :src="coach.coachAvatar" width="134" height="134"></img>
				</div>
			</div>
			<div class="form-group">
				<div class="col-sm-2 control-label"></div> 
				<input type="button" class="btn btn-primary" @click="saveOrUpdate" value="确定"/>
				&nbsp;&nbsp;<input type="button" class="btn btn-warning" @click="reload" value="返回"/>
			</div>
		</form>
	</div>
	<div id="coachLesson" style="display: none">
		<div class="box box-primary" style="margin-top: 1px">
			<div class="box-header">
				<div class="form-group">
					<div class="col-sm-10">
						<div class="input-group date">
							<div class="input-group-addon">
								<i class="fa fa-calendar"></i>
							</div>
							<input type="text" class="form-control " id="datepicker" placeholder="请选择日期">
							<div class="input-group-btn">
								<button class="btn btn-primary" @click="addLesson" v-if="lessons.lessonDate">添加时间价格</button>
							</div>
						</div>
					</div>
				</div>
			</div>
				<div class="box-body">
					<div class="box box-info" style="margin-top: 1px">
						<div class="box-header">
							<div :class="item.flag==-1?'form-group itemDisabled':'form-group'" v-for="(item, index) in lessons.items" >
								<div >
									<div class="input-group date row">
										<div class="input-group-addon">
											<i class="fa fa-calendar"></i>
										</div>
										<vue-timepicker class="form-control input-m"  v-model="item.timeData" format="HH:mm" @change="changeLessonTime($event,index)"></vue-timepicker>
										<!--<input type="time"  class="form-control input-m" required v-model="item.lessonBegStr"  v-on:change="changeLessonTime(item.lessonBegStr,index)">-->
										<div class="input-group-addon">￥价格:</div>
										<input type="number" min="0"  class="form-control input-m" required v-model="item.lessonPrice" v-on:change="updateLesson(index)">
										<div class="input-group-btn">
											<button class="btn btn-danger" @click="delLesson(index)">-</button>
										</div>
										<div class="input-group-btn">
											<button v-if="index==lessons.items.length-1" class="btn btn-primary" @click='addLesson'>+</button>
										</div>
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
	</div>
</div>
<script src="../../js/modules/sys/coach.js"></script>
</body>
</html>